package com.example.perpetualcalendar.ui.fragment.history;


import androidx.annotation.NonNull;

import com.example.perpetualcalendar.data.Api;
import com.example.perpetualcalendar.data.network.CommonRetrofit;
import com.example.perpetualcalendar.domain.entity.History;
import com.example.perpetualcalendar.domain.entity.HistoryRequest;
import com.example.perpetualcalendar.domain.entity.Joke;
import com.example.perpetualcalendar.domain.entity.JokeRequest;
import com.example.perpetualcalendar.domain.repository.ApiHistory;
import com.example.perpetualcalendar.domain.repository.ApiJoke;

import java.util.HashMap;

import io.reactivex.Observable;

public class HistoryRepository extends CommonRetrofit<Api> implements ApiHistory {

    public HistoryRepository() {
    }

    @NonNull
    @Override
    protected Class<Api> getRestClass() {
        return Api.class;
    }

    @NonNull
    @Override
    public Observable<History> historyApi() {
        HistoryRequest request = new HistoryRequest();
        HashMap<String, Object> map = new HashMap<>();
        map.put("key",request.getKey());
        map.put("date",request.getDate());
        Observable<History> history = getNetworkService().getHistory(map);
        return history.map(data-> data);
    }
}
